package controller.seat;

import pojo.Seat;
import service.SeatService;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
import java.io.IOException;
import java.util.List;

@WebServlet(name = "MFloorIndexController", value = "/MFloorIndexController")
public class MFloorIndexController extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        doPost(request, response);
    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        String floorName = request.getParameter("floorName");
        List<Seat> seatList = new SeatService().querySeatsByFloor(floorName);

        request.setAttribute("floorName", floorName);
        request.setAttribute("seatList", seatList);

        request.getRequestDispatcher("/view/manager/seat/seat-page.jsp").forward(request, response);
    }
}
